package myIdeal;

import java.io.IOException;
import java.util.Scanner;

public class ShowDownMyComputer {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
        System.out.println("c:取消关机\ns:关机\n其他:误操作");
        String key = scanner.nextLine();
        switch (key) {
            case "s": {
                System.out.println("你想要在几分钟后关机?");
                int time = scanner.nextInt();
                Runtime.getRuntime().exec("shutdown -s -t" + time);
            }
            case "c":
                Runtime.getRuntime().exec("shutdown -a");
            default:return;
        }
    }
}
